/**
 * 
 */
package com.ms.service.module.zone;

import com.xpec.c4.game.time.TimeConstants;
import com.xpec.c4.game.time.TimeSys;
import com.xpec.c4.game.utility.GUID;

/**
 * 正在登入 zone 中的玩家清單
 * 
 * @author TW15010
 */
public class LoginPlayerInfo {
	/** 過期時間的長度 */
	public static final long EXPIRE_TIME_DURATION = 5 * TimeConstants.MILLI_SECOND_PRE_SECOND;
	
	/** 玩家的 sessionId */
	private GUID sessionId;
	
	/** 登入中玩家資料過期時間 */
	private long expireTime;

	public LoginPlayerInfo(GUID sessionId) {
		this.sessionId = sessionId;
		expireTime = TimeSys.currentTimeMills() + EXPIRE_TIME_DURATION;
	}

	public GUID getSessionId() {
		return sessionId;
	}

	public void setSessionId(GUID sessionId) {
		this.sessionId = sessionId;
	}

	public long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}

	/**
	 * 登入中玩家資訊是否過期
	 * 
	 * @return
	 */
	public boolean isExpire() {
		if (TimeSys.currentTimeMills() >= expireTime) {
			return true;
		}

		return false;
	}
}
